﻿package mortal.game.view.active11
{
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import com.mui.events.*;
    import com.mui.utils.*;
    import extend.language.*;
    import mortal.component.window.*;
    import mortal.game.view.common.*;
    import mortal.mvc.interfaces.*;

    public class Active11Window extends BaseWindow
    {
        protected var _tabBar:GTabBar2;
        protected var _rightPanel:GSprite;
        private static var _instance:Active11Window;

        public function Active11Window(param1:ILayer = null)
        {
            super(param1);
            setSize(900, 600);
            this.title = "" + Language.getString(70817);
            return;
        }// end function

        protected function getActive11Ary() : Array
        {
            var _loc_1:Array = [];
            if (Active11Util.isInActive11Card())
            {
                _loc_1.push(new Active11TabData(Active11TabData.Active11Card, Active11PanelCard));
            }
            _loc_1.push(new Active11TabData(Active11TabData.Active11Login, Active11PanelLogin));
            _loc_1.push(new Active11TabData(Active11TabData.Active11Exp, Active11PanelExp));
            _loc_1.push(new Active11TabData(Active11TabData.Active11Word, Active11PanelWord));
            return _loc_1;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(UIFactory.bg(11, 40, 194, 560, this));
            this._tabBar = UICompomentPool.getUICompoment(GTabBar2);
            this._tabBar.cellRenderer = Active11TabCell;
            this._tabBar.gap = 1;
            this._tabBar.cellWidth = 182;
            this._tabBar.cellHeight = 60;
            this._tabBar.direction = GBoxDirection.VERTICAL;
            this._tabBar.x = 17;
            this._tabBar.y = 47;
            this._tabBar.configEventListener(MuiEvent.GTABBAR_SELECTED_CHANGE, this.onSelectChange);
            this.addChild(this._tabBar);
            this._tabBar.dataProvider = this.getActive11Ary();
            this._tabBar.selectIndex = 0;
            this.updatePanel();
            return;
        }// end function

        protected function onSelectChange(event:MuiEvent = null) : void
        {
            this.updatePanel();
            return;
        }// end function

        protected function updatePanel() : void
        {
            if (this._rightPanel)
            {
                this._rightPanel.dispose();
            }
            var _loc_1:* = this._tabBar.dataProvider[this._tabBar.selectIndex];
            this._rightPanel = UIFactory.getUICompoment(_loc_1.className);
            this._rightPanel.createDisposedChildren();
            UIFactory.setObjAttri(this._rightPanel, 210, 43, -1, -1, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._tabBar.dispose();
            this._tabBar = null;
            this._rightPanel.dispose();
            this._rightPanel = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public static function get instance() : Active11Window
        {
            if (!_instance)
            {
                _instance = new Active11Window;
            }
            return _instance;
        }// end function

    }
}
